<template>
  <div class="allocMenu">
      <el-tree :data="data" show-checkbox node-key="id" :default-checked-keys="array.id" :default-expand-all="true"
          :props="defaultProps" />
      <el-button>取消</el-button>
      <el-button>确认</el-button>
  </div>
</template>

<script setup lang="ts">
import useTable from '../../hooks/useTables'
import * as api from '../../request/api'
import { ref } from 'vue'
import type { Ref } from 'vue'
import { useRoute } from 'vue-router'

let route: any = useRoute().query
console.log(route);

const data: any = ref([])
const array: any = ref([])


const allMenuS = async () => {
  const res = await api.adminA.getmenus()
  data.value = res
  console.log(data);
  return res
}
allMenuS()
const distribution = async () => {
  let res: any = api.adminA.getAdminallowMenu(route.id)
  if (data.vaue == res) {
      array.value = data.value.id
  }
  console.log(res);

}
distribution()
const defaultProps = {
  children: 'children',
  label: 'title',
}

</script>

<style lang="scss" scoped>
.allocMenu {
  width: 90%;
  padding: 30px;
  box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.2);
}
</style>